package com.shimao.celnet.payment.service.impl;

import com.github.pagehelper.PageHelper;
import com.shimao.celnet.payment.form.PPayForm;
import com.shimao.celnet.payment.form.PPayInfoForm;
import com.shimao.celnet.payment.mapper.PPayCupUserMapper;
import com.shimao.celnet.payment.mapper.PPayDetailMapper;
import com.shimao.celnet.payment.mapper.PPayMapper;
import com.shimao.celnet.payment.mapper.PPayRefundMapper;
import com.shimao.celnet.payment.model.PPay;
import com.shimao.celnet.payment.model.PPayCUPUser;
import com.shimao.celnet.payment.model.PPayDetail;
import com.shimao.celnet.payment.service.PPayCupUserService;
import com.shimao.celnet.payment.util.FinalUtil;
import org.apache.log4j.Logger;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 支付申请信息 管理
 * Created by ensure on 2017/12/3.
 */
@Service
public class PPayCupUserServiceImpl extends BaseServiceImpl<PPayCUPUser> implements PPayCupUserService {
    protected Logger logger = Logger.getLogger(this.getClass());

    @Autowired(required = false)
    private PPayCupUserMapper pPayCupUserMapper;

    /**
     * 获取该用户的绑定卡相关信息
     * @param meruserid
     * @return
     */
    @Override
    public List<PPayCUPUser> findCUPUserByMeruserid(String meruserid ,String custid) {

        List<PPayCUPUser> pPayCUPUsers = pPayCupUserMapper.findCUPUserByMeruserid(meruserid,custid);
        if(pPayCUPUsers.size() > 0 && pPayCUPUsers != null){
            return pPayCUPUsers;
        }
        return null;
    }

    /**
     * 获取该用户的绑定卡相关信息
     * @param meruserid
     *  @param agreeid
     * @return
     */
    @Override
    public PPayCUPUser findCUPUserByMeruseridAndAgreeid(String meruserid, String agreeid) {
        return pPayCupUserMapper.findCUPUserByMeruseridAndAgreeid(meruserid,agreeid);
    }

    /**
     * 获取无效注册信息数据
     * @return
     */
    @Override
    public List<PPayCUPUser> findInvalidCUPUsers() {
        return pPayCupUserMapper.findInvalidCUPUsers();
    }

    /**
     *
     * @Author Galen
     * @Description //TODO 通过CUP的相关信息获取注册信息
     * @Date 11:40 2018/11/21
     * @Param [cupMap]
     * @return com.shimao.celnet.payment.model.PPayCUPUser
     */
    @Override
    public PPayCUPUser findCUPUserByCUPMap(Map<String, String> cupMap) {

        return pPayCupUserMapper.findCUPUserByCUPMap(cupMap);
    }

    /**
     *
     * @Author Galen
     * @Description //TODO 根据用户号和银行卡号获取注册信息
     * @Date 13:53 2018/11/21
     * @Param [meruserid, acctno]
     * @return com.shimao.celnet.payment.model.PPayCUPUser
     */
    @Override
    public PPayCUPUser findCUPUserByMeruseridAndBankCardNo(String meruserid, String acctno) {

        return pPayCupUserMapper.findCUPUserByMeruseridAndBankCardNo(meruserid,acctno);
    }

    /**
     *
     * @Author Galen
     * @Description //TODO 获取该用户的绑定卡根据用户号
     * @Date 10:16 2018/11/23
     * @Param [meruserid]
     * @return com.shimao.celnet.payment.model.PPayCUPUser
     */
    @Override
    public PPayCUPUser findCUPUserByMeruserid(String meruserid) {

        return pPayCupUserMapper.findCUPUserByMeruserid1(meruserid);
    }


}
